Page History: Flatten Order
Compare Page Revisions
Page Revision: 2013/02/22 12:39
A Flatten order can be used to flatten a position regardless of what that position is. The T4 FIX API server figures out the volume and Buy/Sell parameters. A Flatten Order is entered with the
New Order Single (Tag 35=D) message. Following are the most relevant tags to build a Flatten order.
Tag 40=F | OrdType | Specifier of Flatten Order Type |
Tag 38 | OrderQty | Set to 0 to have the T4 FIX API server determine the volume needed to flatten the position. A finite quantity can also be entered |
Tag 48 | SecurityID | Market for which the order is sent for |
Tag 55 | Symbol | Contract for which the order is sent for |
Tag 200 | SecurityExchange | Exchange for which the order is sent for |
Tag 167 | SecurityType | Security Type (e.g. Futures) of this specific market |
OrderQty ConsiderationsSpecifying the OrderQty (Tag 38) to 0 also allows the API server to bypass certain risk management checks. For example, if you have a Max Clip Size of 10 but a Max Position of 20 and are currently 15 long, the server can submit a 15 lot sell without being rejected due to exceeding the Max Clip Size of 10.
If a non-zero OrderQty (Tag 28) is specified, this order quantity acts as the maximum volume the server will submit. In the prior example, if a order quantity of 12 is specified then only a 12-lot order would be submitted (instead of a 15 lot order). For example, if at the time of submitting a flatten order, a long position of 15 is held, then an OrderQty of 15 can be specified so that only that 15 (or less) would get flattened (in the event that more fills came in while submitting the order). Note, the specificaiton of OrderQty leads to a check against risk management. The order may be rejected if it does not pass risk assessment (e.g. exceed Max Clip size).
SampleIn this example, the Flatten order is submitted for by entering OrderType (Tag 40) equal to N. Note that the Price (Tag 44) is not entered.
Flatten Order
>> 2/22/2013 12:14:29 PM [FIXNEWORDER] 34=75|49=T4Example|56=T4|50=Ernesto|52=20130222-18:14:29.056|1=Account1|11=fn-634971320690565608|48=CME_20130300_ESH3|55=ES|207=CME_Eq|54=1|38=1|40=N|59=0|167=FUT|21=1|60=20130222-18:14:29.056|204=0|
[FIXNEWORDER]
[MsgSeqNum] 34 = 75
[SenderCompID] 49 = T4Example
[TargetCompID] 56 = T4
[SenderSubID] 50 = Account1
[SendingTime] 52 = 20130222-18:14:29.056
[Account] 1 = ernesto
[ClOrdID] 11 = fn-634971320690565608
[SecurityID] 48 = CME_20130300_ESH3
[Symbol] 55 = ES
[SecurityExchange] 207 = CME_Eq
[Side] 54 = 1 (BUY)
[OrderQty] 38 = 1
[OrdType] 40 = N (JOIN)
[TimeInForce] 59 = 0 (DAY)
[SecurityType] 167 = FUT (FUTURE)
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[TransactTime] 60 = 20130222-18:14:29.056
[CustomerOrFirm] 204 = 0 (CUSTOMER)
Flatten Order Response - Awaiting Trigger
<< 2/22/2013 12:14:29 PM [fixexecutionreport] 34=175|49=T4|56=T4Example|50=T4FIX|52=20130222-18:14:29.056|143=US,IL|1=Account1|11=fn-634971320690565608|17=0.634971320704368750.2.1.79A2601F|150=A|37=79A2601F-8928-4C40-8C5A-86C2F65E0E89|39=A|48=CME_20130300_ESH3|55=ES|207=CME_Eq|200=201303|59=0|107=E-mini S&P 500 Mar13|54=1|167=FUT|38=1|40=N|58=Join Awaiting Trigger|60=20130222-18:14:30.436|21=1|204=0|
[FIXEXECUTIONREPORT]
[MsgSeqNum] 34 = 175
[SenderCompID] 49 = T4
[TargetCompID] 56 = T4Example
[SenderSubID] 50 = T4FIX
[SendingTime] 52 = 20130222-18:14:29.056
[TargetLocationID] 143 = US,IL
[Account] 1 = Account1
[ClOrdID] 11 = fn-634971320690565608
[ExecID] 17 = 0.634971320704368750.2.1.79A2601F
[ExecType] 150 = A (PENDING_NEW)
[OrderID] 37 = 79A2601F-8928-4C40-8C5A-86C2F65E0E89
[OrdStatus] 39 = A (PENDING_NEW)
[SecurityID] 48 = CME_20130300_ESH3
[Symbol] 55 = ES
[SecurityExchange] 207 = CME_Eq
[MaturityMonthYear] 200 = 201303
[TimeInForce] 59 = 0 (DAY)
[SecurityDesc] 107 = E-mini S&P 500 Mar13
[Side] 54 = 1 (BUY)
[SecurityType] 167 = FUT (FUTURE)
[OrderQty] 38 = 1
[OrdType] 40 = N (JOIN)
[Text] 58 = Join Awaiting Trigger
[TransactTime] 60 = 20130222-18:14:30.436
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[CustomerOrFirm] 204 = 0 (CUSTOMER)
Flatten Order Response
<< 2/22/2013 12:14:29 PM [fixexecutionreport] 34=176|49=T4|56=T4Example|50=T4FIX|52=20130222-18:14:29.087|143=US,IL|1=Account1|11=fn-634971320690565608|17=48084.6419495592_ESH3.6349713207052200006.1.79A2601F|150=0|37=79A2601F-8928-4C40-8C5A-86C2F65E0E89|39=0|48=CME_20130300_ESH3|55=ES|207=CME_Eq|200=201303|59=0|107=E-mini S&P 500 Mar13|54=1|167=FUT|38=1|40=2|44=149875|60=20130222-18:14:30.522|21=1|204=0|
[FIXEXECUTIONREPORT]
[MsgSeqNum] 34 = 176
[SenderCompID] 49 = T4
[TargetCompID] 56 = T4Example
[SenderSubID] 50 = T4FIX
[SendingTime] 52 = 20130222-18:14:29.087
[TargetLocationID] 143 = US,IL
[Account] 1 = Account1
[ClOrdID] 11 = fn-634971320690565608
[ExecID] 17 = 48084.6419495592_ESH3.6349713207052200006.1.79A2601F
[ExecType] 150 = 0 (NEW)
[OrderID] 37 = 79A2601F-8928-4C40-8C5A-86C2F65E0E89
[OrdStatus] 39 = 0 (NEW)
[SecurityID] 48 = CME_20130300_ESH3
[Symbol] 55 = ES
[SecurityExchange] 207 = CME_Eq
[MaturityMonthYear] 200 = 201303
[TimeInForce] 59 = 0 (DAY)
[SecurityDesc] 107 = E-mini S&P 500 Mar13
[Side] 54 = 1 (BUY)
[SecurityType] 167 = FUT (FUTURE)
[OrderQty] 38 = 1
[OrdType] 40 = 2 (LIMIT)
[Price] 44 = 149875
[TransactTime] 60 = 20130222-18:14:30.522
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[CustomerOrFirm] 204 = 0 (CUSTOMER)
Flatten Order Fill
<< 2/22/2013 12:14:29 PM [fixexecutionreport] 34=177|49=T4|56=T4Example|50=T4FIX|52=20130222-18:14:29.945|143=US,IL|1=Account1|11=fn-634971320690565608|17=64201:7485971TN0604888.63497132071356000021.2.79A2601F|150=F|37=79A2601F-8928-4C40-8C5A-86C2F65E0E89|39=2|48=CME_20130300_ESH3|55=ES|207=CME_Eq|200=201303|59=0|107=E-mini S&P 500 Mar13|54=1|167=FUT|38=1|40=2|44=149875|31=149875|32=1|14=1|151=0|60=20130222-18:14:31.343|21=1|204=0|337=TRADE|375=CME000A|
[FIXEXECUTIONREPORT]
[MsgSeqNum] 34 = 177
[SenderCompID] 49 = T4
[TargetCompID] 56 = T4Example
[SenderSubID] 50 = T4FIX
[SendingTime] 52 = 20130222-18:14:29.945
[TargetLocationID] 143 = US,IL
[Account] 1 = Account1
[ClOrdID] 11 = fn-634971320690565608
[ExecID] 17 = 64201:7485971TN0604888.63497132071356000021.2.79A2601F
[ExecType] 150 = F
[OrderID] 37 = 79A2601F-8928-4C40-8C5A-86C2F65E0E89
[OrdStatus] 39 = 2 (FILLED)
[SecurityID] 48 = CME_20130300_ESH3
[Symbol] 55 = ES
[SecurityExchange] 207 = CME_Eq
[MaturityMonthYear] 200 = 201303
[TimeInForce] 59 = 0 (DAY)
[SecurityDesc] 107 = E-mini S&P 500 Mar13
[Side] 54 = 1 (BUY)
[SecurityType] 167 = FUT (FUTURE)
[OrderQty] 38 = 1
[OrdType] 40 = 2 (LIMIT)
[Price] 44 = 149875
[LastPx] 31 = 149875
[LastShares] 32 = 1
[CumQty] 14 = 1
[LeavesQty] 151 = 0
[TransactTime] 60 = 20130222-18:14:31.343
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[CustomerOrFirm] 204 = 0 (CUSTOMER)
[ContraTrader] 337 = TRADE
[ContraBroker] 375 = CME000A
Further details on the tags used for this order type are described in the dictionary of the
New Order Single message.